package org.myOrg.spetrum.util;

import org.myOrg.spetrum.combination.Tuple;
import org.myOrg.spetrum.combination.TupleImplement;

public class Transform {
	
	public static String vectorToString(int[] vector){
		String str = "";
		for(int i = 0;i< vector.length ; i++){
			if(vector[i]>=0)
			str += vector[i];
			else
			str += "-" ;
			if(i!=vector.length - 1)
				str += ",";
		}
		return str;
		
	}
	public static Tuple vectorToTuple(int[] vector){
		Tuple tuple = new TupleImplement(getModelDegree(vector));
		int count = 0;
		for (int i = 0; i < vector.length; i++) {
			if (vector[i] >= 0) {
				tuple.set(count, i, vector[i]);
				count++;
			}
		}
		return tuple;
	}
	private static int getModelDegree(int[] temp) {
		int degree = 0;
		for (int i = 0; i < temp.length; i++) {
			if (temp[i] >= 0)
				degree++;

		}
		return degree;
	}
}
